#pragma once

#include "Globals.h"
#include "Item.h"

class Inventory
{
private:
	Item* m_clMyItems;
public:
	//Creates the items and gives them a type
	// without the type they will not be able to funciton
	// Function pointers inside Item are based on the type
	Inventory()
	{
		m_clMyItems = new Item[SIZE_ITEM];
		for(int i = 0;i < SIZE_ITEM;++i)
		{
			m_clMyItems[i].SetType((eItemType)i);
		}
	}

	//To use an item you first must check if you can
	// then it calls that items use fucntion
	const FunctionReturn Use(BaseObject* User, eItemType I)
	{
		if(m_clMyItems[I].IfUsable())
			m_clMyItems[I].Use(User);
		else return FAIL;
		return SUCCEED;
	}

	//Upper level check of if the item is able to be used
	const bool IfUsable(eItemType TYPE) const
	{
		if(TYPE < SIZE_ITEM)
			return m_clMyItems[TYPE].IfUsable();
		else return false;
	}

	//Sets an item to enabled
	// the items are never removed or added, only turned on or off
	const FunctionReturn AddItem(eItemType TYPE)
	{
		if(TYPE < SIZE_ITEM)
			m_clMyItems[TYPE].SetUsableState(true);
		else return INVALID_DATA;
		return SUCCEED;
	}

};